package day13;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Scanner;

/**
 * @author oldliu
 * @since 1.0
 */
public class TeacherTEs2 {
    //获得一个日志对象
    public static final Logger Log= LoggerFactory.getLogger(TeacherTEs2.class);
    public static void main(String[] args) {
        Teacher t=new Teacher();
        Scanner sc=new Scanner(System.in);
        Log.info("请输入老师的姓名：");//System.out不用了
        t.setName(sc.next());
        Log.debug("请输入老师的年龄：");
        while (true){
            try {
                t.setAge(sc.nextInt());
                break;
            } catch (AgeException e) {
                //e.printStackTrace();
                Log.error("年龄非法",e);
            }catch (Exception e){
                Log.error("您输入的不是数字",e);
                sc.next();
            }
        }
        t.selfIntro();
    }
}
